Skip to content

feat: auto-inject conversation id into Orchestrator/Maestro tool calls#878

Closed
maxduu wants to merge 5 commits into
mainfrom
feat-pass-uipath-reserved-convo-id
Closed

feat: auto-inject conversation id into Orchestrator/Maestro tool calls#878
maxduu wants to merge 5 commits into
mainfrom
feat-pass-uipath-reserved-convo-id

Conversation

@maxduu

@maxduu maxduu commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Process-type tools whose input schemas declare a UIPATH_RESERVED_CONVERSATIONID top-level argument now receive the current conversation id automatically. The runtime value always overrides any caller-supplied value; when no conversation id is available, the injection silently no-ops.

The conversation id is read from os.environ["UIPATH_CONVERSATION_ID"], which is populated by UiPathRuntimeContext.with_defaults() (see UiPath/uipath-runtime-python#114). Resolution covers fpsProperties.conversationalService.conversationId from uipath.json. This PR depends on that runtime change to land first.

Test plan

  • tests/agent/tools/test_process_tool.py::TestProcessToolConversationIdInjection — 4 new tests:
    • injects when schema declares the field
    • runtime value overrides caller-supplied value
    • silently omits when conversation id missing
    • skips injection when schema doesn't declare the field
  • Existing 21 process_tool tests still pass
  • End-to-end smoke: run a conversational agent with a Maestro flow tool whose input schema declares UIPATH_RESERVED_CONVERSATIONID; confirm Orchestrator receives the conversation id in input_arguments

Copilot AI review requested due to automatic review settings June 4, 2026 14:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds automatic injection of the current conversation ID into Orchestrator/Maestro process-tool calls when the tool’s input schema declares the reserved UIPATH_RESERVED_CONVERSATIONID top-level field, ensuring the runtime value overrides any caller-supplied value and no-ops when unavailable.

Changes:

  • Inject UIPATH_CONVERSATION_ID (from runtime env) into input_arguments for process-type tools when the reserved schema field is present.
  • Add get_conversation_id() utility and export it from _utils.
  • Add unit tests covering injection, override behavior, no-op behavior, and schema opt-in behavior.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

File Description
src/uipath_langchain/agent/tools/process_tool.py Adds opt-in conversation-id injection into process tool input arguments based on input schema fields.
src/uipath_langchain/_utils/_environment.py Introduces get_conversation_id() reading UIPATH_CONVERSATION_ID from the environment.
src/uipath_langchain/_utils/__init__.py Exports get_conversation_id via package init and __all__.
tests/agent/tools/test_process_tool.py Adds test coverage validating schema-gated injection and override/no-op behavior.

Comment on lines +660 to +669
@pytest.mark.asyncio
@patch("uipath_langchain._utils.durable_interrupt.decorator.interrupt")
@patch("uipath_langchain.agent.tools.process_tool.UiPath")
async def test_omits_when_conversation_id_missing(
self,
mock_uipath_class,
mock_interrupt,
process_resource_with_conversation_id,
):
os.environ.pop("UIPATH_CONVERSATION_ID", None)
@sonarqubecloud

sonarqubecloud Bot commented Jun 4, 2026

Copy link
Copy Markdown

@maxduu maxduu closed this Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants